set nocompatible  "unset vi compatible
syntax on        "turn on syntax highlight

"autocmd BufEnter * lcd %:p:h " change the pwd to the buffer's one
autocmd BufEnter * set path=$PWD/**,$PWD/..,$PWD/../..
" Call gofmt and apply it to the file
function Goformat()
	let regel=line(".")
	%!${GOROOT}/bin/gofmt
	call cursor(regel, 1)
endfunction
" Bind gofmt to :Fmt
autocmd Filetype go command! Fmt call Goformat()

" When gofile, load go syntax + doxygen
autocmd Filetype go set syntax=go.doxygen
" And set colorscheme to darkblue
"colorscheme darkblue

"vars for molokai colorschem
set bg=dark
let g:zenburn_high_Contrast = 1
let g:liquidcarbon_high_contrast = 1
let g:molokai_original = 1
set t_Co=256 "force 256 color mode
"set t_AB=[48;5;%dm
"set t_AF=[38;5;%dm
colorscheme molokai


" Activate type specific indent/plugin
filetype on
filetype indent on
filetype plugin on

set foldmethod=syntax "Set the fold method as syntax described
"highlight Folded term=NONE ctermfg=1 ctermbg=NONE

"better completion menu
"longest -> Add longest common str
"menuone -> don't select the first
set completeopt=longest,menu,preview
" Use Tab instead of c-X/C-o for omni completion
"let g:SuperTabDefaultCompletionType = "<C-X><C-O>"

"inoremap <expr> <CR> pumvisible() ? "\<CR>" : "\<CR>"

"set mouse=a "activate mouse
set listchars=tab:\>\-,trail:.,extends:>,precedes:<,eol:$
"set list "Display tab, EOL etc
set confirm "Ask what to do instead of denying
"set whichwrap+=<,>,h,l "move through end/begin
set fillchars=vert:\ ,stl:\ ,stlnc:\ "make the separators between windows blank
set shortmess=atI " shortens messages to avoid 'press a key' prompt
"set ruler "show x/y cursor position (overrided by :set statusline
set statusline=%F%m%r%h%w\ [%{&ff}]\ [type=%Y]\ [pos=%l,%v][%p%%]\ [len=%L] " configure statusbar
set laststatus=2 "always display status bar
set hlsearch "highlight search
set autowrite "autosave before actions like :make
"set smartindent "smart indent
"set autoindent shiftwidth=4 "indent with 4 spaces
set wildmenu "Show menu options
set number "Show line number
set nowrap "Do not wrap line when too long
set showmatch "Highlight matches braces
set showcmd "show the command typed in command-mode
set hidden "allow to switch buffer without saving
"set comments=sr:/*,mb:**,ex:*/ "??? todo: understand this line
match ErrorMsg /\%>80v.\+/ "Highlight after 80 chars


set cursorline      "underline current line
"set spell           "turn on spell checking
"set spelllang=en_us "set language to english
"set spellsuggest=9  "limit the number of suggestions

"set expandtab     "tab = space
"set tabstop=8     "tab = 8 space
"set softtabstop=8 "makes the spaces feel like real tabs


" Map ± to ~ (macbookpro)
map ± ~
imap ± ~
cmap ± ~
" Map § to ` (macbookpro)
map § `
imap § `
cmap § `


" TODO: test this
"autocmd FileType python set omnifunc=pythoncomplete#Complete
"autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
"autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
"autocmd FileType css set omnifunc=csscomplete#CompleteCSS
"autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
"autocmd FileType php set omnifunc=phpcomplete#CompletePHP
"autocmd FileType c set omnifunc=ccomplete#Complete

